package com.example.project_863.controller;

import com.example.project_863.service.DeviceService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

import java.util.List;
import java.util.Map;

@Controller
@RequestMapping("/device")
public class DeviceController {
    @Autowired
    DeviceService deviceService;
    @RequestMapping("/addBatch")
    @ResponseBody
    public int addBatch(){
        return deviceService.addBatch();
    }
    @RequestMapping("/groupByPro")
    @ResponseBody
    public List<Map> groupByPro(){
        return deviceService.groupByPro();
    }
    @RequestMapping("/groupByAlarm")
    @ResponseBody
    public Map<String, Long> groupByAlarm(){
        return deviceService.groupByAlarm();
    }

    @RequestMapping("/countDeviceNum")
    @ResponseBody
    public List<Map> countDeviceNum(){
        return deviceService.countDeviceNum();
    }
    @RequestMapping("/countTotalNum")
    @ResponseBody
    public List<Map> countTotalNum(){
        return deviceService.countTotalNum();
    }
    @RequestMapping("/countNetworkNum")
    @ResponseBody
    public List<Map> countNetworkNum(){
        return deviceService.countNetworkNum();
    }
}
